package ar.edu.unq.mongodbexample.model;

import java.util.ArrayList;
import java.util.List;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;
import com.google.code.morphia.annotations.Reference;

/**
 * Representa una Carrera Universitaria
 * 
 * @author Nicolas Faure
 */
@Entity(value="careers",noClassnameStored=true)
public class Career {

    private int averageDuration;
    
    @Id
    private String name;

    @Reference(concreteClass = java.util.Vector.class)
	private List<Subject> subjects;

    public Career() {

    }
    
    public Career(int averageDuration,String careerName) {
    	this.setName(careerName);
    	this.setAverageDuration(averageDuration);
    	this.setSubject(new ArrayList<Subject>());
    }
    
    public int getAverageDuration() {
        return this.averageDuration;
    }

    public String getName() {
        return this.name;
    }

    public void setAverageDuration(final int newVal) {
        this.averageDuration = newVal;
    }

    public void setName(final String newVal) {
        this.name = newVal;
    }

	public List<Subject> getSubject() {
		return subjects;
	}

	public void setSubject(List<Subject> subjects) {
		this.subjects = subjects;
	}
	
	public void addSubject(Subject subject) {
		this.subjects.add(subject);
	}

}